<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>


		<script>
			// this = window
			Date.prototype.formatter = function() {
				// console.log("this", this);
				let year = this.getFullYear();
				let month = this.getMonth() + 1;
				let date = this.getDate();
				let hour = this.getHours();
				let mis = this.getMinutes();
				let sec = this.getSeconds() < 10 ? "0" + this.getSeconds() : this.getSeconds();
				let day = this.getDay();

				let format = year + "/" + month + "/" + date + " " + hour + ":" + mis + ":" + sec;
				return format;
			}

			let now = new Date();
			// console.log("now", now)
			// let year = now.getFullYear();
			// let month = now.getMonth() + 1;
			// let date = now.getDate();
			// let hour = now.getHours();
			// let mis = now.getMinutes();
			// let sec = now.getSeconds() < 10 ? "0" + now.getSeconds() : now.getSeconds();
			// let day = now.getDay()


			// let format = year + "/" + month + "/" + date + " " + hour + ":" + mis + ":" + sec;
			//
			// console.log("format", format);


			console.log("now.formatter()", now.formatter());
			let now2 = new Date();


			console.log("now2.formatter()", now2.formatter());
			
			console.log("now2.getTime()",now2.getTime());
			
			let time1 = new Date(1694658936425);
			console.log("time1.formatter():前一天   ", time1.formatter());
			
			
		</script>



	</head>
	<body>
		<h3>请打开浏览器控制台，观察结果</h3>
	</body>
</html>